package com.scsj.supermarket.view.activity.shopmodel;

import android.os.Bundle;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.scsj.supermarket.R;
import com.scsj.supermarket.adapter.ShopBrandAdapter;
import com.scsj.supermarket.customview.GridSpacingItemDecoration;
import com.scsj.supermarket.view.activity.baseactivitymodel.BaseActivity;
import com.vondear.rxtools.RxImageTool;

import java.util.ArrayList;
import java.util.List;


/***
 * 所有品牌
 */
public class AllBrandActivity extends BaseActivity {

    private RecyclerView brand_recyclerview;//品牌列表
    private ShopBrandAdapter shopBrandAdapter;

    @Override
    protected void createView(Bundle savedInstanceState) {
        setContentView(R.layout.activity_all_brand);
        initToolbar();
        setToolbarTitle("店铺销售品牌");
        hasBack(true);
    }

    @Override
    protected void initView() {
        brand_recyclerview = findViewById(R.id.brand_recyclerview);//品牌列表
        brand_recyclerview.setLayoutManager(new GridLayoutManager(this, 2) {
            @Override
            public boolean canScrollVertically() {
                return false;
            }
        });
        brand_recyclerview.addItemDecoration(new GridSpacingItemDecoration(2, RxImageTool.dp2px(10), true));

    }

    @Override
    protected void initListener() {

    }

    @Override
    protected void initData() {
        List<String> list = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            list.add("长城（GreatWall");
            list.add("解百纳赤霞珠干红葡萄酒红葡萄酒红葡萄酒");
            list.add("长城（GreatWall");
            list.add("解百纳赤霞珠干红葡萄酒红葡萄酒红葡萄酒");
        }
        shopBrandAdapter = new ShopBrandAdapter(list);
        brand_recyclerview.setAdapter(shopBrandAdapter);
    }

}
